home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8307.arc
/
LISSAJOU.BAS
< prev
next >
Wrap
BASIC Source File
|
1980-01-01
|
2KB
|
46 lines
10 ' ************ GENERATION OF 3-D LISSAJOUS FIGURE STEREO PAIRS **********
15 '
20 ' (C) Scott Camazine and Westy Dain
25 ' adapted from BYTE, October, 1979
27 '
40 ' VARYING THE PARAMETERS A,B,C,Q,R,S,G GENERATES OTHER LISSAJOUS FIGURES
50 '
60 ' The following sets of parameters yield good figures:
62 '
63 ' A B C Q R S G
64 ' ------------------------------------------------------
65 ' 4 2 8 8 3 5 0
66 ' 4 2 8 2 3 5 0
67 ' 4 2 8 2 3 7 0
68 ' 4 2 8 2 3 0 1
70 '
110 KEY OFF : CLS: SCREEN 2
120 '
130 ' ***************** VARIABLES *******************************************
140 '
150 A=4: B=2.3: C=8: Q=4: R=2: S=0: T=3: G=1 ' LISSAJOUS EQUATION PARAMETERS
160 '
170 ' TRANSFORMATION EQUATION AND PLOTTING PARAMETERS
180 '
190 E = 1.25 'distance from the nose to the eye (inches)
200 F = 100 'scaling factor for the size of the figure
210 ZO = 6 'distance at which the stereo pairs are to be viewed (inches)
220 D = 30 'distance from eye to location of Lissajous figure in space
230 CXL = 75 'variable to position the image on the screen
233 CXR = 600
234 CY = 100
240 ' **************** GENERATE THE PAIRS OF FIGURES *************************
250 '
260 FOR W = 1 TO 8 STEP .01 'Smaller steps give a smoother picture
270 X = A*SIN(Q*W*T) 'general equation for lissajous figures in space
280 Y = B*SIN(R*W*T)
290 Z = C*SIN(S*W*T) + G*W*10
300 X1=((X-E)*ZO/(Z+D)+E)*F ' equations which transform a point in
310 X2=((X+E)*ZO/(Z+D)-E)*F ' space to points on the viewing plane
320 Y1=(Y*ZO/(Z+30))*F
330 PSET(X1+CXL,Y1+CY)
340 PSET(X2+CXR,Y1+CY)
350 NEXT W
360 END
on the viewing plane
32